//
//  BuyMusicViewCellTableViewCell.m
//  MIDI
//
//  Created by E.M.Game on 15/9/8.
//  Copyright (c) 2015年 QXSX. All rights reserved.
//

#import "BuyMusicViewCellTableViewCell.h"
#import "CommFunc.h"

@interface BuyMusicViewCellTableViewCell()

@end

@implementation BuyMusicViewCellTableViewCell

- (void)awakeFromNib
{
    [super awakeFromNib];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    //[super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString *ID = @"BuyMusicViewCell";
    
    BuyMusicViewCellTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    
    if (cell == nil) {
        
        cell = [[[NSBundle mainBundle] loadNibNamed:ID owner:nil options:nil]firstObject];
        
        [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
    }
    
    return cell;
}

//+(id)loadFromNib
//{
//    NSString *xibName = @"BuyMusicViewCell";
//    return [[[NSBundle mainBundle] loadNibNamed:xibName owner:nil options:nil] firstObject];
//}

-(int)getHeight
{
    int height = [CommFunc sizeWithString:self.itemTitle.text
                                     font:[UIFont fontWithName:@"Hiragino Sans GB" size:15]
                                      max:CGSizeMake(self.itemTitle.frame.size.width, MAXFLOAT)].height;
    
    if (height <= 0)
        return 84;
    else
    {
        height = self.itemTitle.frame.origin.y + height + 12 + self.category.frame.size.height + 12 + self.priceLabel.frame.size.height + 15;
        
        return height;
    }
    
    return 0;

}


@end














